Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
available-typed-arrays
Advanced tools
Returns an array of Typed Array names that are available in the current environment
The available-typed-arrays npm package provides a simple way to list all available typed array constructors in the current environment. This can be particularly useful for applications that need to work with binary data in a way that is compatible across different platforms and JavaScript environments. It helps in identifying which typed arrays are supported, allowing developers to write more adaptable and robust code.
Listing available typed arrays
This feature allows you to retrieve an array of strings representing the names of all available typed array constructors. The code sample demonstrates how to use the package to get the list of available typed arrays and then log them to the console.
const availableTypedArrays = require('available-typed-arrays');
const typedArrays = availableTypedArrays();
console.log(typedArrays);
The 'typedarray' package provides a polyfill for TypedArray functionality for older browsers that do not support the latest JavaScript standards. While 'available-typed-arrays' helps in identifying available typed arrays in the environment, 'typedarray' aims to fill the gap by providing the functionality itself when it's not natively available. This makes 'typedarray' more focused on compatibility and polyfilling, whereas 'available-typed-arrays' is more about detection and adaptability.
The 'buffer' package is a node.js library for binary data manipulation. It provides a way to work with binary data through a Buffer class, which is similar to the typed arrays in JavaScript. While 'buffer' is more about providing a comprehensive set of tools for binary data manipulation, 'available-typed-arrays' focuses on identifying which typed array constructors are available in the current environment. 'buffer' can be seen as complementary to 'available-typed-arrays' for applications that need both data manipulation and environment adaptability.
Returns an array of Typed Array names that are available in the current environment.
var availableTypedArrays = require('available-typed-arrays');
var assert = require('assert');
assert.deepStrictEqual(
availableTypedArrays().sort(),
[
'Int8Array',
'Uint8Array',
'Uint8ClampedArray',
'Int16Array',
'Uint16Array',
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array',
'BigInt64Array',
'BigUint64Array'
].sort()
);
Simply clone the repo, npm install
, and run npm test
FAQs
Returns an array of Typed Array names that are available in the current environment
The npm package available-typed-arrays receives a total of 27,697,625 weekly downloads. As such, available-typed-arrays popularity was classified as popular.
We found that available-typed-arrays demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.